#include <iostream>

using namespace std;

#include <pthread.h>
#include <unistd.h>

void *threadRoutine(void *arg)
{
    while (true)
    {
        cout << "threadRoutine thread,pid: " << getpid() << " ppid: " << getppid()
             << " tid: " << pthread_self() << endl;
        sleep(1);
    }
    return nullptr;
}

int main()
{
    pthread_t tid;
    pthread_create(&tid, NULL, threadRoutine, NULL);
    while (true)
    {
        cout << "main thread,pid: " << getpid() << " ppid: " << getppid()
             << " tid: " << pthread_self() << endl;
        sleep(1);
    }
    pthread_join(tid, nullptr);
    return 0;
}